/*
 * Copyright (c) 2019-2020, https://api.iot.10086.cn/(https://gitee.com/cmcc-iot-api/iot-card-open-application/).
 */
package cn.iot.card.open.sim.dto.general;

import cn.iot.card.open.sim.dto.general.enums.BankEnum;

/**
 * 物联卡充值缴费账户DTO
 */
public class SimAccountDTO {
    /**
     * 集团账户
     */
    private String accountId;

    /**
     * 充值标识类型：
     * 1：msisdn
     * 2：账户Id
     */
    private String entityType;

    /**
     * 充值标识类型对应号码
     */
    private String entityId;

    /**
     * 充值金额
     * 单位：元(1.00元—500.00元之间)
     */
    private String chargeMoney;

    /**
     * 支付方式：
     * ALIPAY-WAP:支付宝-手机网站支付
     * ALIPAY-WEB:支付宝-网页即时到账支付
     * ALIPAY-BANK:网银支付
     * WEIXIN-JSAPI:微信-公众号支付
     * WEIXIN-NATIVE:微信-扫码支付
     */
    private String paymentType;

    /**
     * 支付成功后跳转页面的URL，无该参数则不跳转
     */
    private String returnUrl;

    /**
     * 默认网银，在PaymentType为
     * ALIPAY-BANK（网银支付）时必填。
     * 枚举值参见下表“支持的银行及简码”
     */
    private String defaultBank;

    public String getAccountId() {
        return accountId;
    }

    public void setAccountId(String accountId) {
        this.accountId = accountId;
    }

    public String getEntityType() {
        return entityType;
    }

    public void setEntityType(String entityType) {
        this.entityType = entityType;
    }

    public String getEntityId() {
        return entityId;
    }

    public void setEntityId(String entityId) {
        this.entityId = entityId;
    }

    public String getChargeMoney() {
        return chargeMoney;
    }

    public void setChargeMoney(String chargeMoney) {
        this.chargeMoney = chargeMoney;
    }

    public String getPaymentType() {
        return paymentType;
    }

    public void setPaymentType(String paymentType) {
        this.paymentType = paymentType;
    }

    public String getReturnUrl() {
        return returnUrl;
    }

    public void setReturnUrl(String returnUrl) {
        this.returnUrl = returnUrl;
    }

    public String getDefaultBank() {
        return defaultBank;
    }

    public void setDefaultBank(String defaultBank) {
        this.defaultBank = defaultBank;
    }

    @Override
    public String toString() {
        StringBuilder stringBuilder = new StringBuilder();
        if ("1".equals(entityType)) {
            stringBuilder.append("充值标识类型:").append("msisdn").append(",");
        } else if ("2".equals(entityType)) {
            stringBuilder.append("充值标识类型:").append("账户Id").append(",");
        }
        stringBuilder.append("充值标识类型对应号码:").append(entityId).append(",");
        stringBuilder.append("充值金额 单位：元(1.00元—500.00元之间):").append(chargeMoney).append(",");
        switch (paymentType) {
            case "ALIPAY-WAP":
                stringBuilder.append("支付方式:").append("支付宝-手机网站支付").append(",");
                break;
            case "ALIPAY-WEB":
                stringBuilder.append("支付方式:").append("支付宝-网页即时到账支付").append(",");
                break;
            case "ALIPAY-BANK":
                stringBuilder.append("支付方式:").append("网银支付").append(",");
                break;
            case "WEIXIN-JSAPI":
                stringBuilder.append("支付方式:").append("微信-公众号支付").append(",");
                break;
            case "WEIXIN-NATIVE":
                stringBuilder.append("支付方式:").append("微信-扫码支付").append(",");
                break;
        }
        stringBuilder.append("支付成功后跳转页面的URL:").append(returnUrl).append(",");
        stringBuilder.append("默认网银:").append(BankEnum.getByCode(defaultBank).getMessage());
        return stringBuilder.toString();
    }
}
